xquery version "1.0";

declare namespace pm = "http://www.politicalmashup.nl";

import module namespace layout="http://www.example.com/layout" at "xmldb:exist:///db/projdb/modules/layout.xqm";
import module namespace addf="http://www.example.com/addf" at "xmldb:exist:///db/projdb/modules/addf.xqm";
import module namespace activity="http://www.example.com/activity" at "xmldb:exist:///db/projdb/modules/activity.xqm";
import module namespace request="http://exist-db.org/xquery/request";


declare option exist:serialize "doctype-public=-//W3C//DTD&#160;XHTML&#160;1.1//EN
                                doctype-system=http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";

declare variable $id {xs:string(request:get-parameter("id", ()))};
declare variable $individualID {xs:string(request:get-parameter("individualID", ()))};
declare variable $individualName {data(doc('/db/projdb/participatie_parameters_ge2009.xml')/result/tupel[data(@ref) = $individualID]/speaker)};

declare variable $topic {collection('/db/projdb/ge-2009')/root/pm:proceedings/pm:topic[@pm:id=$id]};
declare variable $topic-title {data($topic/@pm:title)};
declare variable $topic-content {<ul xmlns="http://www.w3.org/1999/xhtml" class="topicContent"> {for $speech at $position in $topic/pm:speech return <li class="{concat(if($position mod 2 = 0) then 'evenItem' else 'oddItem', if ($individualName = data($speech/@pm:speaker)) then ' markedItem' else '')}"><p>{string-join(data($speech/pm:p), ' ')}</p></li>}</ul>};


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Activiteit in de plenaire vergaderingen</title>
        <link rel="stylesheet" style="text/css" href="style/core_layout.css"/>	
		<script type="text/javascript" src="js/jquery.js"><!-- --></script>
        <script type="text/javascript" src="js/myScripts.js"><!-- --></script>
        
        
    </head>
    <body>	
            <div class="containerBox">
        {layout:topMenu()}  
 
        <div class="box" id="titleBox">
            <div class="margin">
                <h1>Agendapunt</h1>
                <p>{$topic-title}</p>
            </div>
        </div>

        <div class="box" id="initiativesChartBox">
            <div class="margin">
                <h2 class="boxTitle hiddenElement">Conversatie</h2>
                <div class="boxContent">
                    <div id="initiativesContainer">
                    {$topic-content}
                    </div>
                </div>
            </div>
        </div>
</div>
    </body>
</html>
